//
//  AYMMethodController.m
//  QuickCure
//
//  Created by kangkang on 16/5/6.
//  Copyright © 2016年 ayumi. All rights reserved.
//

#import "AYMMethodController.h"

@interface AYMMethodController ()

@property(nonatomic,strong)NSArray *Array;

@end


NSString *methodID = @"Methodcell";

@implementation AYMMethodController

- (void)viewDidLoad {
    
    [super viewDidLoad];

    [self setupUI];
    
}


# pragma mark -
# pragma mark - setupUI
-(void)setupUI{
    
    self.navigationItem.title = @"治疗方式";
    
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:methodID];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.Array = @[@"手术治疗",@"药物治疗",@"保守治疗"];
 
}

# pragma mark -
# pragma mark - 点击导航栏返回按钮
-(void)back{
    
    [self.navigationController popViewControllerAnimated:YES];
    
}

# pragma mark -
# pragma mark -  tableView 数据源 代理
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.Array.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
   UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:methodID forIndexPath:indexPath];
    
    cell.textLabel.text = self.Array[indexPath.row];
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    NSString *str = self.Array[indexPath.row];
    
    if ([self.delegate respondsToSelector:@selector(methodDelegateWith:)]) {
        
        [self.delegate methodDelegateWith:str];
        
    }
    
     Log(@"%@", str);
    
    [self.navigationController popViewControllerAnimated:YES];
    
   }


@end
